ADD_DEFINITIONS(${SIMD_FLAGS})

CHECK_SYMBOL_EXISTS("__MINGW32__" "" IS_MINGW)
IF(IS_MINGW)
    ADD_DEFINITIONS("-mwindows")
    SET(PLATFORM_SPECIFIC_LIBS mingw32)
ENDIF()

FIND_PACKAGE(Qt5Gui)

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR}
                    ${CARINA_ENGINE_INCLUDE_DIRS}
                    ${Boost_INCLUDE_DIRS})

MESSAGE(${Qt5Gui_INCLUDE_DIRS})

SET(EDITOR_SRC
    ce-viewer.cc
    ce-app.cc
    ced-about.cc
    main.cc
    carina-editor.cc
    scene-explorer.cc
    color-picker-button.cc
    property-editor.cc
    entity-inspector.cc
    )


SET(EDITOR_M_H 
    scene-explorer.hh
    carina-editor.hh
    ce-viewer.hh
    ced-about.hh
    color-picker-button.hh
    property-editor.hh
    property.hh
    entity-inspector.hh
    )
SET(EDITOR_H
    ${EDITOR_M_H}
    ce-app.hh
    ces-converter.hh
    carina-qt-meta-types.hh
    )
SET(EDITOR_UI
    editor.ui
    about-dialog.ui
    scene-explorer.ui
    property-editor.ui
    entity-inspector.ui
    create-model-dialog.ui
    )

SET(EDITOR_RESOURCES
    ${CARINA_TOOLS_DIR}/share/editor.qrc
    )

FIND_PACKAGE(Qt5Widgets)    

QT5_ADD_RESOURCES(EDITOR_RES_SRC ${EDITOR_RESOURCES})
QT5_WRAP_CPP(EDITOR_MOC_SRC ${EDITOR_M_H})
QT5_WRAP_UI(EDITOR_UI_H ${EDITOR_UI})
ADD_EXECUTABLE(carina_editor WIN32 
               ${EDITOR_RES_SRC}
               ${EDITOR_UI_H}
               ${EDITOR_MOC_SRC}
               ${EDITOR_H}
               ${EDITOR_SRC}
               )

TARGET_LINK_LIBRARIES(carina_editor carina_engine ${QT_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS})

 QT5_USE_MODULES(carina_editor Widgets)

INSTALL(TARGETS carina_editor DESTINATION bin)
